#include "curveproperties.h"

CurveProperties::CurveProperties()
{
    mouseover_color = QColor::fromRgbF(1,1,1,1);
    point_color = QColor::fromRgbF(1,0,0,1);
    selected_point_color = QColor::fromRgbF(0,0,1,1);
    curve_color = QColor::fromRgbF(0, 0, 0, 1);
    polyline_color = QColor::fromRgbF(0, 0, 1, 1);
    selection_color =QColor::fromRgbF(0.9, 0.9, 0.9, 1);
    selection_border_color = QColor::fromRgbF(0, 0, 0, 1);

    curve_width  = 2.;
    point_radius = 5;

    no_of_segments = 30;

    draw_curve             = true;
    draw_control_points    = true;
    draw_control_polyline  = false;
    draw_convex_hull       = false;
    draw_selection_box     = false;

    topLeft = bottomRight = QPointF(0,0);
}

QColor CurveProperties::MouseOverColor( ) const
{
    return mouseover_color;
}

QColor CurveProperties::SelectedPointColor( ) const
{
    return selected_point_color;
}

QColor CurveProperties::PointColor( ) const
{
    return point_color;
}

QColor CurveProperties::CurveColor( ) const
{
    return curve_color;
}

QColor CurveProperties::PolylineColor( ) const
{
    return polyline_color;
}

QColor CurveProperties::SelectionColor( ) const
{
    return selection_color;
}

QColor CurveProperties::SelectionBorderColor( ) const
{
    return selection_border_color;
}

float CurveProperties::CurveWidth( ) const
{
    return curve_width;
}

float CurveProperties::PointRadius( ) const
{
    return point_radius;
}

void CurveProperties::SetBorders( QPointF left, QPointF right, QPointF top, QPointF bottom )
{
    topLeft.setX(left.x());
    topLeft.setY(top.y());
    bottomRight.setX(right.x());
    bottomRight.setY(bottom.y());
}

QPointF* CurveProperties::Borders( ) const
{
    QPointF* points = new QPointF[2];

    points[0] = topLeft;
    points[1] = bottomRight;

    return points;
}

void CurveProperties::SetNumberOfSegments( int num )
{
    no_of_segments = num;
}

int CurveProperties::NumberOfSegments( ) const
{
    return no_of_segments;
}

void CurveProperties::ActivateCurve()
{
    draw_selection_box = true;
}

void CurveProperties::DeactivateCurve()
{
    draw_selection_box = false;
}

void CurveProperties::ShowCurve()
{
    draw_curve = true;
}

void CurveProperties::HideCurve()
{
    draw_curve = false;
}

void CurveProperties::ShowControlPoints()
{
    draw_control_points = true;
}

void CurveProperties::HideControlPoints()
{
    draw_control_points = false;
}

void CurveProperties::ShowControlPolyline()
{
    draw_control_polyline = true;
}

void CurveProperties::HideControlPolyline()
{
    draw_control_polyline = false;
}

void CurveProperties::ShowConvexHull()
{
    draw_convex_hull = true;
}

void CurveProperties::HideConvexHull()
{
    draw_convex_hull = false;
}
